<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/jsplib/pubhead.jsp"%>
<%@ page import="net.comm.common.ValueMaping" %>
<%@ taglib uri="/WEB-INF/myTaglib.tld" prefix="tag"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<TITLE>互动区列表</TITLE>
	<link href="${cpath}/css/youlin.css" rel="stylesheet" type="text/css" media="all" />
	<link  href="${cpath}/css/pop.css" rel="stylesheet" type="text/css">

</head>
<body>
<!--外套 start -->
<div class="wrap">
  <!--页首 start -->
	<%@ include file="/menu.jsp"%>
  <!--页首 end -->  
  
  <!--导航面包屑 start -->
  <div class="breadCrumb">
  <div class="breadCrumbNav">当前位置：<a href="${cpath}/users.do?action=main">我的主页</a> >>  <a> 互动区</a></div>
	<%@ include file="/navf.jsp"%> 
 </div> 
  <!--导航面包屑 end -->
  
  <!--主体 start -->
 <div class="body">
 
  <div class="hotBox1">  
    <div class="hotBox1-left">
		<a class="bigpic" href="${cpath}/users.do?action=home&userID=${theForm.qryReceiver}"><b></b><img src="${cpath}/${myfn:getUserPic(theForm.qryReceiver)}" width="75" height="75" ></a>
		<a href="${cpath}/users.do?action=home&userID=${theForm.qryReceiver}">${myfn:getUserName(theForm.qryReceiver)}</a>&nbsp;&gt;&nbsp;<a >互动区</a>
    </div>
    <div class="hotBox1-right">
      <p><a href="javascript:history.go(-1);"><img src="${cpath}/images/icon_32.gif" width="137" height="25" /></a></p>
    </div>
  </div> 
 <div class="nav-active">
  <ul>
    <li class="current" ><a  >互动区</a></li>
  </ul>
 </div>

   <FORM id=theForm name=theForm action='${cpath}/msg.do' method=post>
   <div class="left-Box6-content-inner">

	<TABLE class="noticeList_tbl"width="100%"  align="center" cellpadding="0" cellspacing="0">
	  <TBODY>
	  <TR>
		<TD width=5%>&nbsp;</TD>
		<!--<TD width=5%><A href="javascript:domsg('sort',' Status ');">状态</A></TD>-->
		<TD width=10%><A href="javascript:domsg('sort',' Mtype ');">类型</A></TD>
		<TD width=10% align=center><A href="javascript:domsg('sort',' Receiver ');">对方</A></TD>
		<TD width=45%>标题</TD>
		<TD width=13%><A href="javascript:domsg('sort','Stime');">日期</A></TD>
		<TD width=12%>操作</TD>
		</TR> 
		<c:forEach var="msg" items="${msglist}" varStatus="status"> 
		<TR>
		<TD ><INPUT id=seqID type=checkbox value="${msg.seqID}" name=seqID></TD>
		<!--<TD >${myfn:getMsg("WEBMSG_FLAG",msg.status)}</TD>-->
		<TD align=center>
			<A href="javascript:domsg('adlist','${msg.mtype}');">${myfn:getMsg("MSG_TYPE",msg.mtype)}</A>
		</TD><!---->
		<TD align=center>
			<A href="${cpath}/users.do?action=home&userID=${msg.sender}" target='_blank'>${myfn:getUserNick(msg.sender)}</A>
		</TD>
		<TD ><A href="javascript:disEmail('${msg.title}','${msg.msgID}');">${msg.title}</A></TD>
		<TD >${myfn:formatMDHM(msg.stime)}</TD>
		<TD >
		 <a href="${cpath}/msg.do?action=del&qryReceiver=${userID}&seqID=${msg.seqID}&queryType=${queryType}" title="删除"><img src="${cpath}/icon/icon02.gif" /></a>&nbsp;
		 <c:if test="${msg.status == '1'}">
			<c:if test="${msg.mtype == '3'|| msg.mtype == '4'}">
			<a href="${cpath}/msg.do?action=deal&seqID=${msg.seqID}"><img src="${cpath}/icon/ok.gif" title="同意" width=14 height=15/></a> 
			</c:if>
			<c:if test="${msg.mtype == 'A' || msg.mtype == 'B' || msg.mtype == 'C'}">
			<a href="${cpath}/msg.do?action=deal&seqID=${msg.seqID}" title="验证通过"><img src="${cpath}/icon/okay.png" /></a> 
			</c:if>
		 </c:if>
		 <c:if test="${msg.mtype != '3' && msg.mtype != '4' && msg.mtype != '9' && msg.mtype != 'A'}">
			<a href="javascript:reply('${msg.receiver}','${msg.sender}','${msg.mtype}','${msg.title}');" title="回复TA"><img src="${cpath}/icon/say.jpg"/></a>
		 </c:if>
		 <c:if test="${msg.status == '1'}">
		 <a href="javascript:openliuyan('我投诉：${myfn:getUserNick(msg.sender)}','${msg.sender}','2','${msg.seqID}');" title="举报"><img src="${cpath}/icon/contact_blue_remove.png" /></a>
		 </c:if>
		</TD>
		</TR>
		</c:forEach>
	  <TR>
		<TD class=btn><INPUT onclick="check_all(document.theForm, this.checked)" type=checkbox></TD>
		<TD class="blue btn"><A href="javascript:dodel();">[删除全部]</A></TD>
		<TD class=btn>&nbsp;</TD>
		<TD class=btn>&nbsp;</TD>
		<TD class="blue btn" colSpan=1></TD></TR></TBODY></TABLE>
			
			<INPUT type=hidden name='qrySender'		value='${theForm.qrySender}'>
			<INPUT type=hidden name='qrySendertype' value='${theForm.qrySendertype}'>
			<INPUT type=hidden name='qryReceiver'	value='${theForm.qryReceiver}'>
			<INPUT type=hidden name='qryMtype'		value='${theForm.qryMtype}'>
			<INPUT type=hidden name='qrySeqID'		value='${theForm.qrySeqID}'>
			<INPUT type=hidden name='qryOrderby'	value='${theForm.qryOrderby}'>

			<!-- 分页主键 formName字段当前的form名称 -->
			<%@ include file="/jsplib/page.jsp" %>

			<!-- action字段,用于映射Action中的相关方法,name的值必须使用ACTION常量 -->
			<input type="hidden" name="action" value="list">
   </div>

	</FORM>
  	 <form action="${cpath}/msg.do" name="form_msg"  method="post" enctype="multipart/form-data" class="pic_from">
        <p><textarea name="msg" id="msg" style=" width:600px; height:90px;"></textarea></p>
        <p><a href="javascript:msgsubmit();"><img src="${cpath}/images/icon_09.gif" width="82" height="22"/></a></p>
		<input type="hidden" name='receiver'	value=''/>
		<input type="hidden" name='sender'		value=''/>
		<input type="hidden" name='sendertype'	value='1'/>
		<input type="hidden" name='mtype'		value=''/>
		<input type="hidden" name='title'		value=''/>
		<input type="hidden" name='qryReceiver'	value='${userID}'/>
		<input type="hidden" name='seqID'		value=''/>		
		<input type="hidden" name='action'		value=''/>	
		<input type="hidden" name='queryType' value='${queryType}'/>	
     </form>
    <div class="clearFloat"></div>
 </div> 
 <!--主体 end -->
 
 <!--页脚 start -->
	<%@ include file="/foot.jsp"%>
 <!--页脚 end --> 
</div>
<!--外套 end -->
		<!-- 转发 弹出层 -->
		<DIV class=dragdiv id="disemail" style="DISPLAY:none ">
		<DIV class="otherdiv filterbox">
		<B class=g1></B><B class=g2></B><B class=g3></B><B class=g4></B>
		<DIV class="content filterbox"></DIV>
		<B class=g4></B><B class=g3></B><B class=g2></B><B class=g1></B></DIV>
		<DIV class=otherdivin>
		<H2><SPAN><A title=关闭 style="CURSOR: pointer" onclick="closeMask('disemail')"><IMG src="${cpath}/icon/icon02.gif"></A></SPAN>互动内容： </H2>
			<DL  id="emaildl">
			<DD><EM>标  题：</EM><div id="distitle"></div></DD>
			<DD><EM>内  容：</EM><div id="discontent"></div></DD>
			</DL>
		</DIV></DIV>
		<!-- 弹出层结束 -->

		<!-- 转发 弹出层 -->
		<DIV class=dragdiv id=notadv style="DISPLAY:none ">
		<DIV class="otherdiv filterbox">
		<B class=g1></B><B class=g2></B><B class=g3></B><B class=g4></B>
		<DIV class="content filterbox"></DIV>
		<B class=g4></B><B class=g3></B><B class=g2></B><B class=g1></B></DIV>
		<DIV class=otherdivin>
		<H2><SPAN><A title=关闭 style="CURSOR: pointer" onclick="closeMask('notadv')"><IMG src="${cpath}/icon/icon02.gif"></A></SPAN><div id='divtitle'>我要投诉：</div> </H2>
 		<form action="${cpath}/notadv.do?action=toususer" name="liuyanForm" id="liuyanForm"  method="post" >
			<DL  id="emaildl">
			<DD><EM>标  题：</EM><SPAN><input type='text' name='title' value='${username}的投诉' class="long"/></SPAN></DD>
			<DD><textarea name="content" rows="8" cols="50" ></textarea>
			</DD>
			<DD><EM><INPUT type=button class='shortBtn' name=send value="确  定" onclick="addliuyan('liuyanForm');">&nbsp;&nbsp;
			<INPUT type=button class='shortBtn'  name=cancel value="取  消" onclick="closeMask('notadv');"></EM>
			</DD>
			</DL>
			<!--隐藏域-->
			<input type="hidden" name='userID'	value='${userID}'/>
			<input type="hidden" name='nsort'	value='5'/>
			<input type="hidden" name='nsortID' value=''/>
			<input type="hidden" name='ntype'	value='3'/>
			<input type="hidden" name='tsfr' value=''/>
			<input type="hidden" name='tsfrID' value=''/>
			<input type="hidden" name='queryType' value='${queryType}'/>
			
		</form>  
		</DIV></DIV><!-- 弹出层结束 -->

</body>
</html>
<SCRIPT type=text/javascript>
		//弹出提示层
		function openNewDiv(_id) 
		{
				var m = "mask";
				if(document.getElementById(m)) document.body.removeChild(document.getElementById(m));
				var newMask = document.createElement("div");
				newMask.id = m;
				newMask.style.position = "absolute";
				newMask.style.zIndex = "1";
				_scrollWidth = Math.max(document.body.scrollWidth,document.documentElement.scrollWidth);
				_scrollHeight = Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
				newMask.style.width = _scrollWidth + "px";
				newMask.style.height = _scrollHeight + "px";
				newMask.style.top = "0px";
				newMask.style.left = "0px";
				newMask.style.background = "#33393C";
				newMask.style.filter = "alpha(opacity=40)";
				newMask.style.opacity = "0.30";
				document.body.appendChild(newMask);
				showDiv = document.getElementById(_id);
				showDiv.style.display = "block";
				showDiv.style.position = "absolute";
				showDiv.style.zIndex = "9999";
				showDivWidth = 488;
				showDivHeight = 314;
				showDiv.style.top = (document.documentElement.scrollTop + document.documentElement.clientHeight/2 - showDivHeight/2) + "px";
				showDiv.style.left = (document.documentElement.scrollLeft + document.documentElement.clientWidth/2 -  showDivWidth/2) + "px";
		}
		function closeMask(_id)
		{
				var m = "mask";
				if(document.getElementById(m)) document.body.removeChild(document.getElementById(m));
				showDiv = document.getElementById(_id);
				showDiv.style.display = "none";
		}

	function disEmail(tit,msgID)
	{
		my_getbyid('distitle').innerHTML = tit;
		openNewDiv("disemail");
		getMsgcont(msgID,'discontent');
	}
	function my_getbyid(id)
	{

		 itm = null;
		 if (document.getElementById)
		 {
				itm = document.getElementById(id);
		 }
		 else if (document.all)
		 {
				itm = document.all[id];
		 }
		 else if (document.layers)
		 {
				itm = document.layers[id];
		 }		 
		 return itm;
	}


  /**
     * 检查项目资料维护
     */
	function openliuyan(tit,id,fr,frid)
	{
		var userID = "${userID}";
		if(userID == '' ){
			alert('留言需要登录网站');
			window.location.href ="${cpath}/index.jsp";
			return false;
		}
		var form = document.liuyanForm;

		var nsortID = form['nsortID'];		
		var title = form['title'];
		var content = form['content'];
		var tsfr = form['tsfr'];
		var tsfrID = form['tsfrID'];
		
		nsortID.value = id;
		title.value = tit;
		tsfr.value = fr;
		tsfrID.value = frid;

		/*
		if(type != ""){

			ntype.value = type;
			document.getElementById('divtitle').innerHTML = "发送留言";	
			document.getElementById('radiotype').style.display = "none";
			
		}else{
		
			ntype.value = "3";
			document.getElementById('divtitle').innerHTML = "投诉";			
			document.getElementById('radiotype').style.display = "";
		}
		*/

		openNewDiv("notadv");
	}

	/*
     * 检查项目资料维护
     */
	function addliuyan(objForm)
	{

		var userID = "${userID}";
		if(userID == '' ){
			alert('留言需要登录网站');
			window.location.href ="${cpath}/index.jsp";
			return false;
		}
		var obj	= document.getElementById(objForm);

		var ntype = obj.ntype;
		if(ntype.value == "")
  		{
			alert('类型不能为空');
			ntype.select();
			return ;
		}
		var title = obj.title;
		if(title.value == null||title.value.replace(/(^\s*)|(\s*$)/g,"").length < 1)
  		{
			alert('标题不能为空');
			title.select();
			return ;
		}
		var nsort = obj.nsort;
		if(nsort.value == "")
  		{
			alert('板块不能为空');
			nsort.select();
			return ;
		}
		
		var content = obj.content;
		if(content.value.replace(/(^\s*)|(\s*$)/g,"").length < 1)
		{
			alert('内容不能为空');
			return ;
		}
		if(content.value.length > 2000)
		{
			alert('内容长度不能大于2000');
			return ;
		}
		obj.submit();
	}


	function reply(recv,snd,mt,tit)
	{
		var form = document.form_msg;
		var receiver = form['receiver'];
		var sender = form['sender'];
		var mtype = form['mtype'];
		var title = form['title'];
		var msg = form['msg'];
		
		sender.value = recv;
		receiver.value = snd;
		title.value = "回复：" + tit;
		mtype.value = mt;
		msg.value = "回复：" + tit  + "  ";

		msg.focus();
	}
	function msgsubmit()
	{
		var form = document.form_msg;
		var sender = form['sender'];
		var receiver = form['receiver'];
		var action = form['action'];
		action.value = "send";

		if(sender.value == '' || receiver.value == ''){
			alert('请登陆网站');
			window.location.href ="${cpath}/index.jsp";
			return false;
		}
		if(document.getElementById('msg').value == ''){
			alert('内容不能为空');
			return false;
		}
		if(document.getElementById('msg').value.length > 2000){
			alert('内容超长');
			return false;
		}
		document.form_msg.submit();

	}
   /**
    * 
    */
	function getMsgcont(msgID,div)
	{

		var xmlHttp;
		start = true;
		try
		{    // Firefox, Opera 8.0+, Safari    
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{    // Internet Explorer    
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		var url;
		
		url = "${cpath}/msg/getmsgcont.jsp?msgID=" + msgID ;
		if (start)
		{
			my_getbyid(div).innerHTML='后台取数据……';
			xmlHttp.onreadystatechange=function()
			{
				if(xmlHttp.readyState==4 && xmlHttp.status==200)
				{
					var ret_str = xmlHttp.responseText;

					my_getbyid(div).innerHTML = ret_str;
				}
			}
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null);
		}
	}
function domsg(act, ID)
{
	var form = document.theForm;

	var action = form['action'];
		
	var seqID = form['qrySeqID'];
	var qryMtype = form['qryMtype'];
	var qryOrderby = form['qryOrderby'];

	if(	act == "adlist"){
		action.value = act;
		qryMtype.value = ID;
	}else if(act == "sort"){
		
		action.value = "adlist";
		if(qryOrderby.value.indexOf("Desc",0)==-1)
		{
			qryOrderby.value = ID + " Desc" ;
		}else{		
			qryOrderby.value = ID;
		}
	}else{
		action.value = act;
		seqID.value = ID;
	}

	form.submit();
}
function dodel(form_object)
{
	var form = document.theForm;

	var action = form['action'];
		
	action.value = "del";	
	form.submit();
}

function check_all(form_object, val)
{
	for (var i=0;i<form_object.elements.length;i++)
	{
		var e = form_object.elements[i];
		if ((e.name != 'check_all_box') && (e.type=='checkbox') && (!e.disabled))
		{
			e.checked = val;
		}
	}
}
</SCRIPT>

